{% load static thumbnail humanize %}

<li class="infinite-item card" news-id="{{ news.uuid_id }}">
{#<h1>{{ request.user.username }}</h1>#}
    <div class="card-body">
        <div class="profile-picture">
            {% thumbnail news.user.picture "x50" as im %}
                <img src="{{ im.url }}" class="user-image pull-left" style="border-radius: 50%;" alt="用户头像">
            {% empty %}
                <img src="{% static 'img/user.png' %}" class="pull-left" height="50px" alt="没有头像"/>
            {% endthumbnail %}
        </div>

        <div class="post">
            <!--自己发送的动态显示删除按钮-->
            {% if request.user.username == news.user.username %}
                <a href="{% url 'news:delete_news' news.pk %}">
                    <i class="fa fa-times pull-right" aria-hidden="true" title="点击删除这条动态"></i>
                </a>
            {% endif %}
            <p>
                <strong>
                    <a href="{% url 'users:detail' news.user.username %}">{{ news.user.get_profile_name }}</a>
                </strong>
            </p>
            <p>{{ news }}</p>
        </div>
    </div>
    <div class="interaction" id="interaction">
        <a href="#" class="like" title="{% for i in news.get_likers %}{{ i }}&#10;{% endfor %}">
            {#   判断当前登录用户是否给该评论点赞，来确定样式   #}
            {% if request.user in news.get_likers %}
                <i class="heart fa fa-heart" aria-hidden="true"></i>
            {% else %}
                <i class="heart fa fa-heart-o" aria-hidden="true"></i>
            {% endif %}
            <span class="like-count">{{ news.count_likers }}</span>
        </a>
        <a href="#" class="comment"><i class="fa fa-comment-o" aria-hidden="true"></i>
            <span class="comment-count">{{ news.comment_count }}</span>
        </a>
        <span class="timestamp">{{ news.created_at|timesince}}之前</span>
    </div>
</li>
